import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:winkai/ui/discover/controller/discover_controller.dart';
import 'package:winkai/ui/discover/widget/discover_slider_widget.dart';

class DiscoverPage extends StatefulWidget {
  const DiscoverPage({super.key});

  @override
  State<DiscoverPage> createState() => _DiscoverPageState();
}

class _DiscoverPageState extends State<DiscoverPage> {
  final controller = Get.put(DiscoverController());

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        const DiscoverSliderWidget(),
        Expanded(
          child: PageView(
            controller: controller.pageController,
            physics: const BouncingScrollPhysics(),
            scrollDirection: Axis.horizontal,
            onPageChanged: (int index) {
              controller.selectPage(index, isSwitch: false);
            },
            children: controller.pages,
          ),
        ),
      ],
    );
  }
}
